<template>
  <div>
    <ol class="breadcrumb-nav">
  			<li>
  				<a href="/">主页</a>
  			</li>
  			<li>信息设置</li>
  		</ol>
      <!--文章form-->
      <form class="x-ui-form form pd-20">
        <!--头部名称-->
  			<div class="row cl">
  				<label class="form-label col-2">头部名称</label>
  				<div class="col-10">
  					<input type="text" v-model="settings.name" class="input-text"/>
  				</div>
  			</div>
        <!--博主简介-->
        <div class="row cl">
  				<label class="form-label col-12 text-l">简介</label>
  				<div class="col-12">
  					<textarea class="textarea" v-model="settings.profiles"></textarea>
  				</div>
        </div>
        <!--发布-->
        <div @click="submit" class="btn btn-submit">提交</div>
      </form>
    </div>
</template>
<script>
  export default{
    data(){
      return {
        settings:{}
      }
    },
    methods:{
      submit:function(){
        if(!this.settings.name){
          alert("请输入名称");
        }else{
          this.$http.post("/webSettings" , this.settings , function(res){
            if(res.state == "ok"){
              alert("信息修改成功");
            }else{
              alert(res.message);
            };
          },"JSON");
        };
      }
    },
		route:{
			data(transition){
        this.$http.get("/webSettings" , function(res){
          transition.next({settings:res.data});
        },"JSON")
      }
    }
  }
</script>
